<%@ page import="com.oms.domain.User" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.HashMap" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>${userMsg.name }详细信息</title>
	<script type="text/javascript">
		function viewimg(){ 
			var imgup=document.getElementById("file"); 
			var imgpath=getPath(imgup); 
			//判断是否是图片格式 
			var imgname=imgup.value.substring(imgup.value.lastIndexOf("."),imgup.value.length) 
			imgname=imgname.toLowerCase() 
			if ((imgname!='.jpg')&&(imgname!='.gif')&&(imgname!='.jpeg')&&(imgname!='.png')&&(imgname!='.bmp')){ 
			alert("请选择图片文件，谢谢!"); 
			imgup.focus(); 
			//清空file里面的值 
			imgup.select();   
			document.selection.clear(); 
			} 
			else{ 
			//显示图片 
			document.getElementById("img").src=imgpath;
			} 
		} 
	</script>
</head>
<body>
  <div align="center">
  	<h1>${userMsg.name }详细信息</h1><hr>
  	<font color="red">${msg }</font>
  	<a href="${pageContext.request.contextPath}/changePasswordPage.do">修改密码</a>
 	<form action="${pageContext.request.contextPath}/updateHeadPortrait.do" method="post" enctype="multipart/form-data" >
	  	<table>
	  		<tr>
	  			<td>${requestScope.uploadMsg }</td>
	  		</tr>
	 		<tr>
	 			<td>头像:</td>
	 			<td><img alt="点击更换" width="80" height="80" src="${pageContext.request.contextPath }/${userMsg.headImageSrc}"></td>
	 				<td><input type="file" id="file1"  name="file" value="上传头像" onblur="viewimg()"/></td>
	 				<td><img id="img" alt="" src="" onclick="viewimg()"> </td>
	 				<td><input type="submit" value="上传"/></td>
	 		</tr>
	  	</table>
  	</form>
  	<form:form action="${pageContext.request.contextPath }/user/${userMsg.userId }.do" method="POST" modelAttribute="userMsg" >
  		<input type="hidden" name="_method" value="PUT"/>
  		<table>
 			<tr>
  				<td>用户名:</td>
  				<td><form:input   path="name" readonly="false" cssClass="canEdit" /></td>
  				<td id="name_msg"></td>
  			</tr>

  			<tr>
  				<td>注册邮箱:</td>
  				<td><form:input id="email" path="email" readonly="false"/></td>
  				<td id="email_msg"></td>
  			</tr>
			 <tr>
  				<td>电话号码:</td>
  				<td><form:input   path="moblie" readonly="false" cssClass="canEdit" /></td>
  				<td id="moblie_msg"></td>
  			</tr>
			<tr>
  				<td>QQ号:</td>
  				<td><form:input   path="qqNo" readonly="false" cssClass="canEdit" /></td>
  				<td id="qqNo_msg"></td>
  			</tr>
			<tr>
<%-- 			<% 
				Map<String, String> genders = new HashMap<String,String>();
				genders.put("1", "男");
				genders.put("0", "女");
				request.setAttribute("genders", genders);
			%> --%>
  				<td>性别:</td>
  				<td><form:select path="sex" items="${genders }" delimiter="&nbsp&nbsp" readonly="false" cssClass="canEdit"/></td>
  				<td id="sex_msg"></td>
  			</tr>
  			<tr>
  				<td>生日:</td>
  				<td><form:input   path="birthday" readonly="false" cssClass="canEdit" /></td>
  				<td id="birthday_msg"></td>
  			</tr>
  			<tr>
  				<td>真实姓名:</td>
  				<td><form:input   path="trueName"  cssClass="canEdit" /></td>
  				<td id="trueName_msg"></td>
  			</tr>
<%--  			<% 
				Map<String, String> educations = new HashMap<String,String>();
				educations.put("0", "请选择");
				educations.put("1", "初中");
				educations.put("2", "高中");
				educations.put("3", "大专");
				educations.put("4", "本科");
				educations.put("5", "硕士");
				educations.put("6", "博士");
				educations.put("7", "博士后");
				request.setAttribute("educations", educations);
			%> --%>
  			<tr>
  				<td>文化水平:</td>
  				<td><form:select  path="educationBackground" items="${educations }" delimiter="&nbsp&nbsp" readonly="false"  cssClass="canEdit" /></td>
  				<td id="educationBackground_msg"></td>
  			</tr>
  			<tr>
  				<td>毕业院校:</td>
  				<td><form:input   path="graduateInstitutions" readonly="false" cssClass="canEdit" /></td>
  				<td id="graduateInstitutions_msg"></td>
  			</tr>
  			<tr>
  				<td>地址:</td>
  				<td><form:input   path="address" readonly="false" cssClass="canEdit" /></td>
  				<td id="address_msg"></td>
  			</tr>
  			
  			<tr><td><font size="20">在校信息</font></td></tr>
  			<tr>
  				<td>所读高校:</td>
  				<td><form:input   path="college" readonly="false" cssClass="canEdit" /></td>
  				<td id="address_msg"></td>
  			</tr>
  			<tr>
  				<td>所读高校:</td>
  				<td><form:input   path="college" readonly="false" cssClass="canEdit" /></td>
  				<td id="address_msg"></td>
  			</tr>
  			<tr>
  				<td>所在学院:</td>
  				<td><form:input   path="academy" readonly="false" cssClass="canEdit" /></td>
  				<td id="address_msg"></td>
  			</tr>
  			<tr>
  				<td>所读专业:</td>
  				<td><form:input   path="major" readonly="false" cssClass="canEdit" /></td>
  				<td id="address_msg"></td>
  			</tr>
  			<tr>
  				<td>班级:</td>
  				<td><form:input   path="class_" readonly="false" cssClass="canEdit" /></td>
  				<td id="address_msg"></td>
  			</tr>
  			<tr>
  				<td>学号:</td>
  				<td><form:input   path="schoolNo" readonly="false" cssClass="canEdit" /></td>
  				<td id="address_msg"></td>
  			</tr>
  			<tr>
  				<td>校内地址:</td>
  				<td><form:input   path="addressOfSchool" readonly="false" cssClass="canEdit" /></td>
  				<td id="address_msg"></td>
  			</tr>
  			<tr>
  				<td>校内短号:</td>
  				<td><form:input   path="schoolCornet" readonly="false" cssClass="canEdit" /></td>
  				<td id="address_msg"></td>
  			</tr>
  			
  			<tr>
  				<td><input type="submit" value="保存"/></td>
  			</tr>
  		</table>
  	</form:form>
  </div>
  </body>
</html>